import request from '@/utils/request'

const api_name = '/acl/role'

export default {
  // 新增角色
  save(role) {
    return request({
      url: `${api_name}`,
      method: 'post',
      data: role
    })
  },
  // 获取角色分页列表
  getPageList(roleQuery) {
    return request({
      url: `${api_name}/list`,
      method: 'post',
      data: roleQuery
    })
  },
  // 根据ID查询
  getById(id) {
    return request({
      url: `${api_name}/${id}`,
      method: 'get'
    })
  },
  // 修改角色
  updateById(role) {
    return request({
      url: `${api_name}`,
      method: 'put',
      data: role
    })
  },
  getAssign(roleId) {
    return request({
      url: `${api_name}/toAssign/${roleId}`,
      method: 'get'
    })
  },
  // 删除角色
  removeById(id) {
    return request({
      url: `${api_name}/${id}`,
      method: 'delete'
    })
  },
  // 批量删除角色
  removeRows(idList) {
    return request({
      url: `${api_name}/list`,
      method: 'delete',
      data: idList
    })
  }

}
